<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="styles/style.css">
        <link rel="stylesheet" href="styles/theme/atom-one-dark.css">
        <title>例子3-JS进阶（二）</title>
    </head>
    <body>
        <pre>
            <code>
                // 例子3

                (function () {
                    var a = 10;
                    var b = 20;

                    function add(num1, num2) {
                        var num1 = !!num1 ? num1 : a;
                        var num2 = !!num2 ? num2 : b;

                        return num1 + num2;
                    }

                    window.add = add;
                })();

                add(10, 20);
            </code>
        </pre>
        <script src="scripts/libs/highlight.pack.js"></script>
        <script src="scripts/3.js"></script>
        <script>
            hljs.initHighlightingOnLoad();
        </script>
    </body>
</html>